<?php

namespace Vavilen\FirstBundle\DataFixtures\ORM;

use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\FixtureInterface;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Common\Persistence\ObjectManager;
use Vavilen\FirstBundle\Entity\Tag;

class LoadTagData extends AbstractFixture implements OrderedFixtureInterface, FixtureInterface
{
	public function load(ObjectManager $manager)
	{
		$tag1 = new Tag();
		$tag1->setTagName('Математика');
		$tag1->setUrl('math');
		$manager->persist($tag1);
		$this->addReference('math', $tag1);

		$tag2 = new Tag();
		$tag2->setTagName('Алгебра');
		$tag2->setUrl('alg');
		$manager->persist($tag2);
		$this->addReference('alg', $tag2);

		$tag3 = new Tag();
		$tag3->setTagName('Геометрия');
		$tag3->setUrl('Geo');
		$manager->persist($tag3);
		$this->addReference('Geo', $tag3);

		$tag4 = new Tag();
		$tag4->setTagName('Физика');
		$tag4->setUrl('phys');
		$manager->persist($tag4);
		$this->addReference('phys', $tag4);

		$manager->flush();
	}

	public function getOrder()
	{
		return 2;
	}
}